#include "CompactGraph.h"

namespace native_orbitor
{

CompactGraph::CompactGraph( int vertexCount, int edgesCount )
	: stBuf( vertexCount )
	, nxBuf( edgesCount )
	, destBuf( edgesCount )
	, k( 0 )
{
	st = & stBuf[0];
	std::fill( st, st + vertexCount, -1 );
	nx = & nxBuf[0];
	dest = & destBuf[0];
}

size_t CompactGraph::getVertexCount()
{
	return stBuf.size();
}

void CompactGraph::addEdge( int beg, int end )
{
	dest[k] = end;
	nx[k] = st[beg];
	st[beg] = k;
	k++;
}

}
